.class public Lcom/opongo/blogapp/activities/PostViewScrollActivity;
.super Landroid/app/ActivityGroup;
.source "PostViewScrollActivity.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/opongo/blogapp/activities/PostViewScrollActivity$UnlockRefresh;
    }
.end annotation


# static fields
.field public static final DEBUG:Z

.field protected static final IDS:[I

.field protected static final POSTCOLUMNS:[Ljava/lang/String;


# instance fields
.field private cursor:Landroid/database/Cursor;

.field protected dbManager:Lcom/opongo/blogapp/manager/DatabaseManager;

.field protected lockLoading:Z

.field private lockRefresh:Z

.field protected mAdapter:Lcom/opongo/blogapp/adapter/PostViewGalleryAdapter;

.field private position:I

.field private postContent:Landroid/widget/RelativeLayout;

.field protected post_id:I

.field private query:Ljava/lang/String;

.field protected queryLimit:I

.field private table_name:Ljava/lang/String;

.field private timer:Ljava/util/Timer;


# direct methods
.method static constructor <clinit>()V
    .locals 4

    .prologue
    const/4 v3, 0x4

    .line 34
    sget-boolean v0, Lcom/opongo/blogapp/AbaSettings;->DEBUG:Z

    sput-boolean v0, Lcom/opongo/blogapp/activities/PostViewScrollActivity;->DEBUG:Z

    .line 51
    const/16 v0, 0xa

    new-array v0, v0, [Ljava/lang/String;

    const/4 v1, 0x0

    .line 52
    const-string v2, "_id"

    aput-object v2, v0, v1

    const/4 v1, 0x1

    const-string v2, "id"

    aput-object v2, v0, v1

    const/4 v1, 0x2

    const-string v2, "title"

    aput-object v2, v0, v1

    const/4 v1, 0x3

    .line 53
    const-string v2, "date"

    aput-object v2, v0, v1

    const-string v1, "content"

    aput-object v1, v0, v3

    const/4 v1, 0x5

    const-string v2, "categories"

    aput-object v2, v0, v1

    const/4 v1, 0x6

    .line 54
    const-string v2, "commentscount"

    aput-object v2, v0, v1

    const/4 v1, 0x7

    const-string v2, "imageurl"

    aput-object v2, v0, v1

    const/16 v1, 0x8

    const-string v2, "post_order"

    aput-object v2, v0, v1

    const/16 v1, 0x9

    .line 55
    const-string v2, "opened"

    aput-object v2, v0, v1

    .line 51
    sput-object v0, Lcom/opongo/blogapp/activities/PostViewScrollActivity;->POSTCOLUMNS:[Ljava/lang/String;

    .line 57
    new-array v0, v3, [I

    fill-array-data v0, :array_0

    sput-object v0, Lcom/opongo/blogapp/activities/PostViewScrollActivity;->IDS:[I

    .line 32
    return-void

    .line 57
    :array_0
    .array-data 0x4
        0x25t 0x0t 0x8t 0x7ft
        0x29t 0x0t 0x8t 0x7ft
        0x2bt 0x0t 0x8t 0x7ft
        0x2at 0x0t 0x8t 0x7ft
    .end array-data
.end method

.method public constructor <init>()V
    .locals 1

    .prologue
    .line 32
    invoke-direct {p0}, Landroid/app/ActivityGroup;-><init>()V

    .line 43
    const/16 v0, 0x14

    iput v0, p0, Lcom/opongo/blogapp/activities/PostViewScrollActivity;->queryLimit:I

    .line 45
    const/4 v0, 0x0

    iput v0, p0, Lcom/opongo/blogapp/activities/PostViewScrollActivity;->post_id:I

    .line 32
    return-void
.end method

.method static synthetic access$0(Lcom/opongo/blogapp/activities/PostViewScrollActivity;I)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 61
    iput p1, p0, Lcom/opongo/blogapp/activities/PostViewScrollActivity;->position:I

    return-void
.end method

.method static synthetic access$1(Lcom/opongo/blogapp/activities/PostViewScrollActivity;)Landroid/database/Cursor;
    .locals 1
    .parameter

    .prologue
    .line 60
    iget-object v0, p0, Lcom/opongo/blogapp/activities/PostViewScrollActivity;->cursor:Landroid/database/Cursor;

    return-object v0
.end method

.method static synthetic access$2(Lcom/opongo/blogapp/activities/PostViewScrollActivity;)I
    .locals 1
    .parameter

    .prologue
    .line 61
    iget v0, p0, Lcom/opongo/blogapp/activities/PostViewScrollActivity;->position:I

    return v0
.end method

.method static synthetic access$3(Lcom/opongo/blogapp/activities/PostViewScrollActivity;Landroid/database/Cursor;)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 152
    invoke-direct {p0, p1}, Lcom/opongo/blogapp/activities/PostViewScrollActivity;->setPostContent(Landroid/database/Cursor;)V

    return-void
.end method

.method static synthetic access$4(Lcom/opongo/blogapp/activities/PostViewScrollActivity;Z)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 39
    iput-boolean p1, p0, Lcom/opongo/blogapp/activities/PostViewScrollActivity;->lockRefresh:Z

    return-void
.end method

.method static synthetic access$5(Lcom/opongo/blogapp/activities/PostViewScrollActivity;)Z
    .locals 1
    .parameter

    .prologue
    .line 39
    iget-boolean v0, p0, Lcom/opongo/blogapp/activities/PostViewScrollActivity;->lockRefresh:Z

    return v0
.end method

.method static synthetic access$6(Lcom/opongo/blogapp/activities/PostViewScrollActivity;Ljava/util/Timer;)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 49
    iput-object p1, p0, Lcom/opongo/blogapp/activities/PostViewScrollActivity;->timer:Ljava/util/Timer;

    return-void
.end method

.method static synthetic access$7(Lcom/opongo/blogapp/activities/PostViewScrollActivity;)Ljava/util/Timer;
    .locals 1
    .parameter

    .prologue
    .line 49
    iget-object v0, p0, Lcom/opongo/blogapp/activities/PostViewScrollActivity;->timer:Ljava/util/Timer;

    return-object v0
.end method

.method private setPostContent(Landroid/database/Cursor;)V
    .locals 11
    .parameter "cursor"

    .prologue
    .line 154
    invoke-virtual {p0}, Lcom/opongo/blogapp/activities/PostViewScrollActivity;->getLocalActivityManager()Landroid/app/LocalActivityManager;

    move-result-object v3

    .line 156
    .local v3, mgr:Landroid/app/LocalActivityManager;
    const-string v8, "_id"

    invoke-interface {p1, v8}, Landroid/database/Cursor;->getColumnIndex(Ljava/lang/String;)I

    move-result v2

    .line 157
    .local v2, keyIndex:I
    invoke-interface {p1, v2}, Landroid/database/Cursor;->getInt(I)I

    move-result v1

    .line 159
    .local v1, key:I
    iget-object v8, p0, Lcom/opongo/blogapp/activities/PostViewScrollActivity;->dbManager:Lcom/opongo/blogapp/manager/DatabaseManager;

    invoke-virtual {v8, v1}, Lcom/opongo/blogapp/manager/DatabaseManager;->queryForPostByPrimary(I)Lcom/opongo/blogapp/common/Post;

    move-result-object v4

    .line 161
    .local v4, p:Lcom/opongo/blogapp/common/Post;
    iget-object v8, p0, Lcom/opongo/blogapp/activities/PostViewScrollActivity;->dbManager:Lcom/opongo/blogapp/manager/DatabaseManager;

    iget v9, v4, Lcom/opongo/blogapp/common/Post;->id:I

    const/4 v10, 0x1

    invoke-virtual {v8, v9, v10}, Lcom/opongo/blogapp/manager/DatabaseManager;->setOpened(II)I

    .line 163
    const-string v8, "unique_per_activity_string"

    invoke-virtual {v3, v8}, Landroid/app/LocalActivityManager;->getActivity(Ljava/lang/String;)Landroid/app/Activity;

    move-result-object v5

    check-cast v5, Lcom/opongo/blogapp/activities/PostViewActivity;

    .line 165
    .local v5, pva:Lcom/opongo/blogapp/activities/PostViewActivity;
    if-eqz v5, :cond_1

    .line 166
    invoke-virtual {v5, v4}, Lcom/opongo/blogapp/activities/PostViewActivity;->showPost(Lcom/opongo/blogapp/common/Post;)V

    .line 183
    :cond_0
    :goto_0
    return-void

    .line 168
    :cond_1
    new-instance v0, Landroid/content/Intent;

    const-class v8, Lcom/opongo/blogapp/activities/PostViewActivity;

    invoke-direct {v0, p0, v8}, Landroid/content/Intent;-><init>(Landroid/content/Context;Ljava/lang/Class;)V

    .line 169
    .local v0, i:Landroid/content/Intent;
    const-string v8, "POST"

    invoke-virtual {v0, v8, v4}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/io/Serializable;)Landroid/content/Intent;

    .line 170
    const-string v8, "TABLENAME"

    iget-object v9, p0, Lcom/opongo/blogapp/activities/PostViewScrollActivity;->dbManager:Lcom/opongo/blogapp/manager/DatabaseManager;

    invoke-virtual {v9}, Lcom/opongo/blogapp/manager/DatabaseManager;->getTableName()Ljava/lang/String;

    move-result-object v9

    invoke-virtual {v0, v8, v9}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    .line 171
    const/high16 v8, 0x400

    invoke-virtual {v0, v8}, Landroid/content/Intent;->addFlags(I)Landroid/content/Intent;

    .line 173
    const-string v8, "unique_per_activity_string"

    invoke-virtual {v3, v8, v0}, Landroid/app/LocalActivityManager;->startActivity(Ljava/lang/String;Landroid/content/Intent;)Landroid/view/Window;

    move-result-object v6

    .line 175
    .local v6, w:Landroid/view/Window;
    if-eqz v6, :cond_2

    invoke-virtual {v6}, Landroid/view/Window;->getDecorView()Landroid/view/View;

    move-result-object v7

    .line 177
    .local v7, wd:Landroid/view/View;
    :goto_1
    const v8, 0x7f08002e

    invoke-virtual {p0, v8}, Lcom/opongo/blogapp/activities/PostViewScrollActivity;->findViewById(I)Landroid/view/View;

    move-result-object v8

    check-cast v8, Landroid/widget/RelativeLayout;

    iput-object v8, p0, Lcom/opongo/blogapp/activities/PostViewScrollActivity;->postContent:Landroid/widget/RelativeLayout;

    .line 179
    if-eqz v7, :cond_0

    .line 180
    iget-object v8, p0, Lcom/opongo/blogapp/activities/PostViewScrollActivity;->postContent:Landroid/widget/RelativeLayout;

    const/4 v9, 0x0

    invoke-virtual {v8, v7, v9}, Landroid/widget/RelativeLayout;->addView(Landroid/view/View;I)V

    goto :goto_0

    .line 175
    .end local v7           #wd:Landroid/view/View;
    :cond_2
    const/4 v7, 0x0

    goto :goto_1
.end method


# virtual methods
.method public onCreate(Landroid/os/Bundle;)V
    .locals 9
    .parameter "savedInstanceState"

    .prologue
    const v3, 0x7f030012

    .line 66
    invoke-super {p0, p1}, Landroid/app/ActivityGroup;->onCreate(Landroid/os/Bundle;)V

    .line 67
    invoke-virtual {p0, v3}, Lcom/opongo/blogapp/activities/PostViewScrollActivity;->setContentView(I)V

    .line 70
    invoke-virtual {p0}, Lcom/opongo/blogapp/activities/PostViewScrollActivity;->getIntent()Landroid/content/Intent;

    move-result-object v0

    invoke-virtual {v0}, Landroid/content/Intent;->getExtras()Landroid/os/Bundle;

    move-result-object v7

    .line 73
    .local v7, extras:Landroid/os/Bundle;
    if-eqz v7, :cond_0

    .line 75
    const-string v0, "POSITION"

    invoke-virtual {v7, v0}, Landroid/os/Bundle;->getInt(Ljava/lang/String;)I

    move-result v0

    iput v0, p0, Lcom/opongo/blogapp/activities/PostViewScrollActivity;->position:I

    .line 76
    const-string v0, "TABLENAME"

    invoke-virtual {v7, v0}, Landroid/os/Bundle;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    iput-object v0, p0, Lcom/opongo/blogapp/activities/PostViewScrollActivity;->table_name:Ljava/lang/String;

    .line 77
    const-string v0, "QUERY"

    invoke-virtual {v7, v0}, Landroid/os/Bundle;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    iput-object v0, p0, Lcom/opongo/blogapp/activities/PostViewScrollActivity;->query:Ljava/lang/String;

    .line 82
    :goto_0
    new-instance v0, Lcom/opongo/blogapp/manager/DatabaseManager;

    .line 83
    iget-object v1, p0, Lcom/opongo/blogapp/activities/PostViewScrollActivity;->table_name:Ljava/lang/String;

    invoke-direct {v0, p0, v1}, Lcom/opongo/blogapp/manager/DatabaseManager;-><init>(Landroid/content/Context;Ljava/lang/String;)V

    .line 82
    iput-object v0, p0, Lcom/opongo/blogapp/activities/PostViewScrollActivity;->dbManager:Lcom/opongo/blogapp/manager/DatabaseManager;

    .line 86
    iget-object v0, p0, Lcom/opongo/blogapp/activities/PostViewScrollActivity;->dbManager:Lcom/opongo/blogapp/manager/DatabaseManager;

    iget-object v1, p0, Lcom/opongo/blogapp/activities/PostViewScrollActivity;->query:Ljava/lang/String;

    invoke-virtual {v0, v1}, Lcom/opongo/blogapp/manager/DatabaseManager;->query(Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v0

    iput-object v0, p0, Lcom/opongo/blogapp/activities/PostViewScrollActivity;->cursor:Landroid/database/Cursor;

    .line 88
    iget-object v0, p0, Lcom/opongo/blogapp/activities/PostViewScrollActivity;->cursor:Landroid/database/Cursor;

    invoke-virtual {p0, v0}, Lcom/opongo/blogapp/activities/PostViewScrollActivity;->startManagingCursor(Landroid/database/Cursor;)V

    .line 90
    new-instance v0, Lcom/opongo/blogapp/adapter/PostViewGalleryAdapter;

    .line 91
    iget-object v4, p0, Lcom/opongo/blogapp/activities/PostViewScrollActivity;->cursor:Landroid/database/Cursor;

    sget-object v5, Lcom/opongo/blogapp/activities/PostViewScrollActivity;->POSTCOLUMNS:[Ljava/lang/String;

    sget-object v6, Lcom/opongo/blogapp/activities/PostViewScrollActivity;->IDS:[I

    move-object v1, p0

    move-object v2, p0

    invoke-direct/range {v0 .. v6}, Lcom/opongo/blogapp/adapter/PostViewGalleryAdapter;-><init>(Landroid/app/Activity;Landroid/content/Context;ILandroid/database/Cursor;[Ljava/lang/String;[I)V

    .line 90
    iput-object v0, p0, Lcom/opongo/blogapp/activities/PostViewScrollActivity;->mAdapter:Lcom/opongo/blogapp/adapter/PostViewGalleryAdapter;

    .line 94
    const v0, 0x7f080030

    invoke-virtual {p0, v0}, Lcom/opongo/blogapp/activities/PostViewScrollActivity;->findViewById(I)Landroid/view/View;

    move-result-object v8

    check-cast v8, Landroid/widget/Gallery;

    .line 96
    .local v8, g:Landroid/widget/Gallery;
    const v0, 0x3eb33333

    invoke-virtual {v8, v0}, Landroid/widget/Gallery;->setUnselectedAlpha(F)V

    .line 97
    iget-object v0, p0, Lcom/opongo/blogapp/activities/PostViewScrollActivity;->mAdapter:Lcom/opongo/blogapp/adapter/PostViewGalleryAdapter;

    invoke-virtual {v8, v0}, Landroid/widget/Gallery;->setAdapter(Landroid/widget/SpinnerAdapter;)V

    .line 98
    iget v0, p0, Lcom/opongo/blogapp/activities/PostViewScrollActivity;->position:I

    invoke-virtual {v8, v0}, Landroid/widget/Gallery;->setSelection(I)V

    .line 101
    new-instance v0, Lcom/opongo/blogapp/activities/PostViewScrollActivity$1;

    invoke-direct {v0, p0}, Lcom/opongo/blogapp/activities/PostViewScrollActivity$1;-><init>(Lcom/opongo/blogapp/activities/PostViewScrollActivity;)V

    invoke-virtual {v8, v0}, Landroid/widget/Gallery;->setOnItemClickListener(Landroid/widget/AdapterView$OnItemClickListener;)V

    .line 108
    new-instance v0, Lcom/opongo/blogapp/activities/PostViewScrollActivity$2;

    invoke-direct {v0, p0}, Lcom/opongo/blogapp/activities/PostViewScrollActivity$2;-><init>(Lcom/opongo/blogapp/activities/PostViewScrollActivity;)V

    invoke-virtual {v8, v0}, Landroid/widget/Gallery;->setOnItemSelectedListener(Landroid/widget/AdapterView$OnItemSelectedListener;)V

    .line 128
    return-void

    .line 79
    .end local v8           #g:Landroid/widget/Gallery;
    :cond_0
    iget-object v0, p0, Lcom/opongo/blogapp/activities/PostViewScrollActivity;->cursor:Landroid/database/Cursor;

    invoke-interface {v0}, Landroid/database/Cursor;->moveToFirst()Z

    goto :goto_0
.end method

.method public onCreateOptionsMenu(Landroid/view/Menu;)Z
    .locals 2
    .parameter "menu"

    .prologue
    .line 187
    invoke-virtual {p0}, Lcom/opongo/blogapp/activities/PostViewScrollActivity;->getMenuInflater()Landroid/view/MenuInflater;

    move-result-object v0

    const v1, 0x7f0e0004

    invoke-virtual {v0, v1, p1}, Landroid/view/MenuInflater;->inflate(ILandroid/view/Menu;)V

    .line 188
    invoke-super {p0, p1}, Landroid/app/ActivityGroup;->onCreateOptionsMenu(Landroid/view/Menu;)Z

    move-result v0

    return v0
.end method

.method protected onDestroy()V
    .locals 1

    .prologue
    .line 199
    iget-object v0, p0, Lcom/opongo/blogapp/activities/PostViewScrollActivity;->dbManager:Lcom/opongo/blogapp/manager/DatabaseManager;

    invoke-virtual {v0}, Lcom/opongo/blogapp/manager/DatabaseManager;->close()V

    .line 200
    invoke-super {p0}, Landroid/app/ActivityGroup;->onDestroy()V

    .line 201
    return-void
.end method

.method public onOptionsItemSelected(Landroid/view/MenuItem;)Z
    .locals 5
    .parameter "item"

    .prologue
    const/4 v2, 0x1

    .line 204
    invoke-virtual {p0}, Lcom/opongo/blogapp/activities/PostViewScrollActivity;->getLocalActivityManager()Landroid/app/LocalActivityManager;

    move-result-object v0

    .line 205
    .local v0, mgr:Landroid/app/LocalActivityManager;
    const-string v3, "unique_per_activity_string"

    invoke-virtual {v0, v3}, Landroid/app/LocalActivityManager;->getActivity(Ljava/lang/String;)Landroid/app/Activity;

    move-result-object v1

    check-cast v1, Lcom/opongo/blogapp/activities/PostViewActivity;

    .line 207
    .local v1, pva:Lcom/opongo/blogapp/activities/PostViewActivity;
    if-eqz v1, :cond_3

    .line 208
    invoke-interface {p1}, Landroid/view/MenuItem;->getItemId()I

    move-result v3

    const v4, 0x7f080067

    if-ne v3, v4, :cond_0

    .line 209
    invoke-virtual {v1}, Lcom/opongo/blogapp/activities/PostViewActivity;->showComments()V

    .line 222
    :goto_0
    return v2

    .line 211
    :cond_0
    invoke-interface {p1}, Landroid/view/MenuItem;->getItemId()I

    move-result v3

    const v4, 0x7f080065

    if-ne v3, v4, :cond_1

    .line 212
    invoke-virtual {v1}, Lcom/opongo/blogapp/activities/PostViewActivity;->addBookmark()V

    goto :goto_0

    .line 214
    :cond_1
    invoke-interface {p1}, Landroid/view/MenuItem;->getItemId()I

    move-result v3

    const v4, 0x7f080066

    if-ne v3, v4, :cond_2

    .line 215
    invoke-virtual {v1}, Lcom/opongo/blogapp/activities/PostViewActivity;->share()V

    goto :goto_0

    .line 218
    :cond_2
    invoke-super {p0, p1}, Landroid/app/ActivityGroup;->onOptionsItemSelected(Landroid/view/MenuItem;)Z

    move-result v2

    goto :goto_0

    .line 222
    :cond_3
    invoke-super {p0, p1}, Landroid/app/ActivityGroup;->onOptionsItemSelected(Landroid/view/MenuItem;)Z

    move-result v2

    goto :goto_0
.end method

.method public onPause()V
    .locals 1

    .prologue
    .line 193
    iget-object v0, p0, Lcom/opongo/blogapp/activities/PostViewScrollActivity;->timer:Ljava/util/Timer;

    if-eqz v0, :cond_0

    iget-object v0, p0, Lcom/opongo/blogapp/activities/PostViewScrollActivity;->timer:Ljava/util/Timer;

    invoke-virtual {v0}, Ljava/util/Timer;->cancel()V

    .line 194
    :cond_0
    invoke-super {p0}, Landroid/app/ActivityGroup;->onPause()V

    .line 195
    return-void
.end method
